package com.tedu.bill.demo8;

/**
 * Author：毕龙
 * Date: 2024/4/17 10:55
 */
public class TestConstructor {
    public static void main(String[] args) {
        //创建对象时 虚拟机自动调用构造方法
        Teacher t1 = new Teacher();
        System.out.println(t1.name);
        System.out.println(t1.age);
        System.out.println(t1.course);
        //调用有参的构造方法
        Teacher t2 = new Teacher("小花");
        System.out.println(t2.name);
        //调用三个参数的构造方法创建对象
        Teacher t3 = new Teacher("曹洋", 20, "Spring");
        System.out.println(t3.name);
        System.out.println(t3.age);
        System.out.println(t3.course);
    }
}
